import back from "@/assets/back.png";
import back1 from "@/assets/back1.png";
import { navigateBack } from "@/utils/common";
import { Image, View } from '@tarojs/components';
import './index.scss';

type IProps = {
	title: string;
	left?: boolean;
	type?: string;
	onBack?: any;
	bg?: boolean;
	location?: boolean;
	onLocationChange?: (val) => void
}

export default function BackTitle(props: IProps) {
	const { title, left = true, type = "black",bg = false } = props;

	return (
		<View className='back-title' style={{
			backgroundColor: bg ? '#1e6dcc' : 'transparent'
		}}
		>
			{left ?
				<View className="title-img-wrap"
					onClick={() => {
						navigateBack({ delta: 1 });
					}}
				>
					<Image
						mode="widthFix"
						className='title-img'

						src={type == "white" ? back : back1}
					/>
				</View>
				: null}
			<View className={`title-word ${left ? 'title-padding-right' : ''}`} style={{ color: type == "white" ? "white" : "black" }}>{title}</View>
		</View>
	)
}


